using UnityEngine;
using System.Collections;

public class ComponentThrust : MonoBehaviour 
{
	[SerializeField]
	public Transform goTransform;
	protected float ThrustStrength = 10.0f;

	// NOTE: The Ship prefab is locked to the X-Y plane by freezing its Z coordinate.
	// Refer to the Rigidbody component on the Ship prefab: Constraints -> Freeze Position
	
	void Awake()
	{
		//get this GameObject's Transform
		goTransform = this.GetComponent<Transform>();
	}
	
	// Update is called once per frame
	void Update ()
	{
		// NOTE: Assumes the ship's default placement is upwards
		
		// Forward
		if (Input.GetKey(KeyCode.UpArrow))
		{
			goTransform.Translate(Vector3.up * ThrustStrength * Time.deltaTime);
			//Moving the game Object.
		}
		if (Input.GetKey(KeyCode.DownArrow))
		{
			goTransform.Translate(-Vector3.up * ThrustStrength * Time.deltaTime);
			//Moving the game Object.
		}
		
	}
}